

///////////
// Setup //
///////////

log close _all
log using "3_Supplementary_Materials_Tables.smcl", replace


///////////////////////////////////////////////////////////////////////////////////////
// Table A1: Life Satisfaction of Volunteers and Non-Volunteers in External Datasets //
///////////////////////////////////////////////////////////////////////////////////////

// See Table_A1.xlsx


//////////////////////////////////////////////////////////////////////////////////////
// Table A2: Understanding Society Covid-19 Wave (USC19) vs. Main Estimation Sample //
//////////////////////////////////////////////////////////////////////////////////////

// See Tables_A2_A3.xlsx


////////////////////////////////////////////////////////////////////////////
// Table A3: UCL Covid-19 Social Study (UCL19) vs. Main Estimation Sample //
////////////////////////////////////////////////////////////////////////////

// See Tables_A2_A3.xlsx


/////////////////////////////////////////////////////////
// Table A4: Additionally Controlling for Waiting Time //
/////////////////////////////////////////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_a                 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust
reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_a                 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust
reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_a                 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust
reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust

sum belongingness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_a                 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust
reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* waiting_time if(marker == 1 & balancedness == 1), robust

sum connectedness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker


/////////////////////////////////////////////////
// Table A5: Alternative Geographical Controls //
/////////////////////////////////////////////////

// Variables

generate postcode_admin_aggregated4 = substr(pafpostcode, 1, 4)
tabulate postcode_admin_aggregated4, generate(postcode_admin_aggregated4_)

tabulate lad17nm, generate(lad17nm_)

// Postcode Area and District Fixed Effects (1,630)
///////////////////////////////////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_a  $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust
reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_a  $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust
reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_a  $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust
reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust

sum belongingness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_a  $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust
reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated4_* if(marker == 1 & balancedness == 1), robust

sum connectedness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Local-Authority District (LAD) Fixed Effects (309)
/////////////////////////////////////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum belongingness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum connectedness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Table A6: Testing Predictive Power of Local-Area Characteristics for Number of Tasks at Local-Authority District (LAD) Level //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

preserve

// Local-Area Data (Indices of Multiple Deprivation) and Alerts

use "Admin_Data_Alerts_IMDs_LADs.dta", clear

// Number of Tasks
//////////////////

tabulate lad_name, generate(lad_name)

reg alert_lad ib1.year incomescoreexponentiallytransfor employmentscoreexponentiallytran educationscoreexponentiallytrans healthscoreexponentiallytransfor crimescoreexponentiallytransform barriersscoreexponentiallytransf livingenvironmentscoreexponentia imdrankwhere1ismostdeprived imddecilewhere1ismostdeprived10o incomerankwhere1ismostdeprived incomedecilewhere1ismostdeprived employmentrankwhere1ismostdepriv employmentdecilewhere1ismostdepr educationrankwhere1ismostdeprive educationwhere1ismostdeprived10o healthrankwhere1ismostdeprived healthdecilewhere1ismostdeprived crimerankwhere1ismostdeprived crimedecilewhere1ismostdeprived1 housingrankwhere1ismostdeprived housingdecilewhere1ismostdeprive environmentrankwhere1ismostdepri environmentdecilewhere1ismostdep, robust
reg alert_lad ib1.year incomescoreexponentiallytransfor employmentscoreexponentiallytran educationscoreexponentiallytrans healthscoreexponentiallytransfor crimescoreexponentiallytransform barriersscoreexponentiallytransf livingenvironmentscoreexponentia imdrankwhere1ismostdeprived imddecilewhere1ismostdeprived10o incomerankwhere1ismostdeprived incomedecilewhere1ismostdeprived employmentrankwhere1ismostdepriv employmentdecilewhere1ismostdepr educationrankwhere1ismostdeprive educationwhere1ismostdeprived10o healthrankwhere1ismostdeprived healthdecilewhere1ismostdeprived crimerankwhere1ismostdeprived crimedecilewhere1ismostdeprived1 housingrankwhere1ismostdeprived housingdecilewhere1ismostdeprive environmentrankwhere1ismostdepri environmentdecilewhere1ismostdep lad_name1 lad_name2 lad_name3 lad_name4 lad_name5 lad_name6 lad_name7 lad_name8 lad_name9 lad_name10 lad_name11 lad_name12 lad_name13 lad_name14 lad_name15 lad_name16 lad_name17 lad_name18 lad_name19 lad_name20 lad_name21 lad_name22 lad_name23 lad_name24 lad_name25 lad_name26 lad_name27 lad_name28 lad_name29 lad_name30 lad_name31 lad_name32 lad_name33 lad_name34 lad_name35 lad_name36 lad_name37 lad_name38 lad_name39 lad_name40 lad_name41 lad_name42 lad_name43 lad_name44 lad_name45 lad_name46 lad_name47 lad_name48 lad_name49 lad_name50 lad_name51 lad_name52 lad_name53 lad_name54 lad_name55 lad_name56 lad_name57 lad_name58 lad_name59 lad_name60 lad_name61 lad_name62 lad_name63 lad_name64 lad_name65 lad_name66 lad_name67 lad_name68 lad_name69 lad_name70 lad_name71 lad_name72 lad_name73 lad_name74 lad_name75 lad_name76 lad_name77 lad_name78 lad_name79 lad_name80 lad_name81 lad_name82 lad_name83 lad_name84 lad_name85 lad_name86 lad_name87 lad_name88 lad_name89 lad_name90 lad_name91 lad_name92 lad_name93 lad_name94 lad_name95 lad_name96 lad_name97 lad_name98 lad_name99 lad_name100 lad_name101 lad_name102 lad_name103 lad_name104 lad_name105 lad_name106 lad_name107 lad_name108 lad_name109 lad_name110 lad_name111 lad_name112 lad_name113 lad_name114 lad_name115 lad_name116 lad_name117 lad_name118 lad_name119 lad_name120 lad_name121 lad_name122 lad_name123 lad_name124 lad_name125 lad_name126 lad_name127 lad_name128 lad_name129 lad_name130 lad_name131 lad_name132 lad_name133 lad_name134 lad_name135 lad_name136 lad_name137 lad_name138 lad_name139 lad_name140 lad_name141 lad_name142 lad_name143 lad_name144 lad_name145 lad_name146 lad_name147 lad_name148 lad_name149 lad_name150 lad_name151 lad_name152 lad_name153 lad_name154 lad_name155 lad_name156 lad_name157 lad_name158 lad_name159 lad_name160 lad_name161 lad_name162 lad_name163 lad_name164 lad_name165 lad_name166 lad_name167 lad_name168 lad_name169 lad_name170 lad_name171 lad_name172 lad_name173 lad_name174 lad_name175 lad_name176 lad_name177 lad_name178 lad_name179 lad_name180 lad_name181 lad_name182 lad_name183 lad_name184 lad_name185 lad_name186 lad_name187 lad_name188 lad_name189 lad_name190 lad_name191 lad_name192 lad_name193 lad_name194 lad_name195 lad_name196 lad_name197 lad_name198 lad_name199 lad_name200 lad_name201 lad_name202 lad_name203 lad_name204 lad_name205 lad_name206 lad_name207 lad_name208 lad_name209 lad_name210 lad_name211 lad_name212 lad_name213 lad_name214 lad_name215 lad_name216 lad_name217 lad_name218 lad_name219 lad_name220 lad_name221 lad_name222 lad_name223 lad_name224 lad_name225 lad_name226 lad_name227 lad_name228 lad_name229 lad_name230 lad_name231 lad_name232 lad_name233 lad_name234 lad_name235 lad_name236 lad_name237 lad_name238 lad_name239 lad_name240 lad_name241 lad_name242 lad_name243 lad_name244 lad_name245 lad_name246 lad_name247 lad_name248 lad_name249 lad_name250 lad_name251 lad_name252 lad_name253 lad_name254 lad_name255 lad_name256 lad_name257 lad_name258 lad_name259 lad_name260 lad_name261 lad_name262 lad_name263 lad_name264 lad_name265 lad_name266 lad_name267 lad_name268 lad_name269 lad_name270 lad_name271 lad_name272 lad_name273 lad_name274 lad_name275 lad_name276 lad_name277 lad_name278 lad_name279 lad_name280 lad_name281 lad_name282 lad_name283 lad_name284 lad_name285 lad_name286 lad_name287 lad_name288 lad_name289 lad_name290 lad_name291 lad_name292 lad_name293 lad_name294 lad_name295 lad_name296 lad_name297 lad_name298 lad_name299 lad_name300 lad_name301 lad_name302 lad_name303 lad_name304 lad_name305 lad_name306 lad_name307 lad_name308 lad_name309 lad_name310 lad_name311 lad_name312 lad_name313 lad_name314 lad_name315 lad_name316 lad_name317 lad_name318 lad_name319 lad_name320 lad_name321 lad_name322 lad_name323 lad_name324 lad_name325 lad_name326 lad_name327 lad_name328 lad_name329 lad_name330 lad_name331 lad_name332, robust

restore

// Local-Authority District (LAD) Fixed Effects (309)
/////////////////////////////////////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum belongingness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_a  $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust
reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z lad17nm_* if(marker == 1 & balancedness == 1), robust

sum connectedness if(marker == 1)
tab treatment_a if(marker == 1)

drop marker


/////////////////////////////////////////////////////////////////////
// Table A7: Extended Estimation Sample vs. Main Estimation Sample //
/////////////////////////////////////////////////////////////////////

preserve

use "Extended_Estimation_Sample.dta", clear
append using "Main_Estimation_Sample.dta"

tabulate age, generate(age_)
tabulate gender, generate(gender_)
tabulate ethnicity, generate(ethnicity_)
tabulate religion, generate(religion_)
tabulate condition, generate(condition_)
tabulate isolating, generate(isolating_)
tabulate employment, generate(employment_)
tabulate volunteered_before, generate(volunteered_before_)
tabulate volunteered_elsewhere, generate(volunteered_elsewhere_)
tabulate volunteered_elsewhere_where, generate(vol_elsewhere_where_)

eststo: estpost ttest age_1 age_2 age_3 age_4 age_5 age_6 age_7 age_8 gender_1 gender_2 gender_3 gender_4 ethnicity_1 ethnicity_2 ethnicity_3 ethnicity_4 ethnicity_5 ethnicity_6 ethnicity_7 ethnicity_8 ethnicity_9 ethnicity_10 ethnicity_11 ethnicity_12 ethnicity_13 ethnicity_14 ethnicity_15 ethnicity_16 ethnicity_17 ethnicity_18 religion_1 religion_2 religion_3 religion_4 religion_5 religion_6 religion_7 religion_8 religion_9 condition_1 condition_2 condition_3 condition_4 isolating_1 isolating_2 isolating_3 employment_1 employment_2 employment_3 employment_4 employment_5 employment_6 employment_7 employment_8 employment_9 motivations_reduc1_1 motivations_reduc1_2 motivations_reduc1_3 motivations_reduc1_4 motivations_reduc1_5 motivations_reduc1_6 motivations_reduc1_7 motivations_reduc1_8 motivations_reduc1_9 motivations_reduc1_10 volunteered_before_1 volunteered_before_2 volunteered_elsewhere_1 volunteered_elsewhere_2 volunteered_elsewhere_3  vol_elsewhere_where_2 vol_elsewhere_where_3 vol_elsewhere_where_4 vol_elsewhere_where_5 vol_elsewhere_where_6 vol_elsewhere_where_7 vol_elsewhere_where_8 newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate, by(delineater)

esttab est1 using "Table_A7", rtf label replace modelwidth(4) ///
title(Differences in Means: Extended vs. Main) mtitles ///
cells("mu_1(fmt(4)) mu_2(fmt(4)) b(star f(4)) p(fmt(4))") ///
starlevels(* 0.10 ** 0.05 *** 0.01)
eststo clear

global variables "age_1 age_2 age_3 age_4 age_5 age_6 age_7 age_8 gender_1 gender_2 gender_3 gender_4 ethnicity_1 ethnicity_2 ethnicity_3 ethnicity_4 ethnicity_5 ethnicity_6 ethnicity_7 ethnicity_8 ethnicity_9 ethnicity_10 ethnicity_11 ethnicity_12 ethnicity_13 ethnicity_14 ethnicity_15 ethnicity_16 ethnicity_17 ethnicity_18 religion_1 religion_2 religion_3 religion_4 religion_5 religion_6 religion_7 religion_8 religion_9 condition_1 condition_2 condition_3 condition_4 isolating_1 isolating_2 isolating_3 employment_1 employment_2 employment_3 employment_4 employment_5 employment_6 employment_7 employment_8 employment_9 motivations_reduc1_1 motivations_reduc1_2 motivations_reduc1_3 motivations_reduc1_4 motivations_reduc1_5 motivations_reduc1_6 motivations_reduc1_7 motivations_reduc1_8 motivations_reduc1_9 motivations_reduc1_10 volunteered_before_1 volunteered_before_2 volunteered_elsewhere_1 volunteered_elsewhere_2 volunteered_elsewhere_3  vol_elsewhere_where_2 vol_elsewhere_where_3 vol_elsewhere_where_4 vol_elsewhere_where_5 vol_elsewhere_where_6 vol_elsewhere_where_7 vol_elsewhere_where_8 newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate"

display "Means of Extended"

foreach m of global variables {
	
	quietly sum `m' if(delineater == 0)
	
	scalar `m'_t0_m = r(mean)
	
	display `m'_t0_m
	
}	

display "Means of Main"

foreach m of global variables {
	
	quietly sum `m' if(delineater == 1)
	
	scalar `m'_t1_m = r(mean)
	
	display `m'_t1_m
	
}	

display "Standard Deviations of Extended"

foreach m of global variables {
	
	quietly sum `m' if(delineater == 0)
	
	scalar `m'_t0_v = r(Var)
	
	display sqrt(`m'_t0_v)
	
}	

display "Standard Deviations of Main"

foreach m of global variables {
	
	quietly sum `m' if(delineater == 1)
	
	scalar `m'_t1_v = r(Var)
	
	display sqrt(`m'_t1_v)
	
}	

display "Normalised Differences"

foreach m of global variables {
	
	scalar `m'_nd = abs((`m'_t1_m - `m'_t0_m)/sqrt(`m'_t1_v + `m'_t0_v))
	
	display `m'_nd
	
}	

restore

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Table A8: Average Treatment Effects (Weighted by Inverse Probability of Being in Main Estimation Sample) //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

preserve

// Administrative Data

/*

append using "Admin_Data_Universe_2a.dta"
append using "Admin_Data_Universe_2b.dta"
append using "Admin_Data_Universe_2c.dta"
append using "Admin_Data_Universe_2d.dta"
append using "Admin_Data_Universe_2e.dta"

*/

// Variables

/*

generate admin_records_refined = 1 if(responderId != . & (neverdownloadedapp == "NULL" & number_days_duty >= 1))

generate survey_admin_data_response = .
replace survey_admin_data_response = 1 if(respondentid != . & responderId != .)
replace survey_admin_data_response = 0 if(respondentid == . | responderId == .)

generate treatment_a_2 = .
replace treatment_a_2 = 1 if(allocatedTask == 1 & acceptedTask == 1 & completedTask == 1)
replace treatment_a_2 = 0 if(allocatedTask == 0 | (allocatedTask == 1 & acceptedTask == 0 & numberTimedOutTasks > 0))
tab treatment_a_2

generate date_birth = date(dateOfBirth, "DMY")
format date_birth %td
generate year_birth = year(date_birth)
generate age_temp = 2020 - year_birth
replace age_temp = . if(age_temp < 18)

replace age2 = 1 if(age2 == . & age_temp != . & (age_temp < 16 | (age_temp >= 16 & age_temp <= 24)))
replace age2 = 2 if(age2 == . & age_temp != . & ((age_temp >= 25 & age_temp <= 34)))
replace age2 = 3 if(age2 == . & age_temp != . & ((age_temp >= 35 & age_temp <= 44)))
replace age2 = 4 if(age2 == . & age_temp != . & ((age_temp >= 45 & age_temp <= 54)))
replace age2 = 5 if(age2 == . & age_temp != . & ((age_temp >= 55 & age_temp <= 64)))
replace age2 = 6 if(age2 == . & age_temp != . & ((age_temp >= 65)))

generate postcode_admin_agg2 = substr(pafpostcode, 1, 2)
tabulate postcode_admin_agg2, generate(postcode_admin_agg2_)

*/

// Inverse-Probability Weights

global ttb1 "allocatedTask acceptedTask completedTask timedOutTask rejectedTask"
global ttb2 "numberAllocatedTasks numberAcceptedTask numberTasksCompleted numberTimedOutTasks numberRejectedTasks"
global ttb3 "transport communityResponse checkInAndChat"
global r "postcode_admin_agg2_*"

reg survey_admin_data_response treatment_a_2 if(admin_records_refined == 1), robust
predict propensity_score1
generate weight1 = (1/propensity_score1)

reg survey_admin_data_response treatment_a_2 $ttb1 $ttb2 $ttb3 $r if(admin_records_refined == 1), robust
predict propensity_score2
generate weight2 = (1/propensity_score2)

// Estimation Sample

reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight1] if(balancedness == 1), robust
keep if(e(sample) == 1)

// Inverse Probability Weights from Table 7 Column 1
////////////////////////////////////////////////////

// Life Satisfaction

reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight1] if(balancedness == 1), robust

sum satisfaction_life if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Sense of Purpose in Life

reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight1] if(balancedness == 1), robust

sum worthwhileness_life if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Belongingness

reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight1] if(balancedness == 1), robust

sum belongingness if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Connectedness

reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight1] if(balancedness == 1), robust

sum connectedness if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Inverse Probability Weights from Table 7 Column 2
////////////////////////////////////////////////////

generate weight3 = weight2
replace weight3 = 0.00001 if(weight2 < 0)

// Life Satisfaction

reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight3] if(balancedness == 1), robust

sum satisfaction_life if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Sense of Purpose in Life

reg worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight3] if(balancedness == 1), robust

sum worthwhileness_life if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Belongingness

reg belongingness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight3] if(balancedness == 1), robust

sum belongingness if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

// Connectedness

reg connectedness treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* [aw=weight3] if(balancedness == 1), robust

sum connectedness if(e(sample) == 1)
tab treatment_a if(e(sample) == 1)

restore


//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// B. Replication Using Extended Estimation Sample (Old Working Paper Before Revisions) //
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////

generate balancedness_old = 1 if(!missing(satisfaction_life, worthwhileness_life, belongingness, connectedness, prosociality))

///////////////////////////////////////////////////////////////////////
// Table B1: Average Treatment Effects in Extended Estimation Sample //
///////////////////////////////////////////////////////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & balancedness_old == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & balancedness_old == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & balancedness_old == 1), robust

sum belongingness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & balancedness_old == 1), robust

sum connectedness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Pro-Sociality

quietly reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & balancedness_old == 1), robust

sum prosociality if(marker == 1)
tab treatment_s if(marker == 1)

drop marker


/////////////////////////////////////////////////////////////////////////////////////////////
// Table B2: Heterogeneous Treatment Effects By Type of Task in Extended Estimation Sample //
/////////////////////////////////////////////////////////////////////////////////////////////

// Transport
////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_1 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_1 == 1 & balancedness_old == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_1 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_1 == 1 & balancedness_old == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_1 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_1 == 1 & balancedness_old == 1), robust

sum belongingness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_1 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_1 == 1 & balancedness_old == 1), robust

sum connectedness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Pro-Sociality

quietly reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_1 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_1 == 1 & balancedness_old == 1), robust

sum prosociality if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Community Response
/////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_2 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_2 == 1 & balancedness_old == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_2 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_2 == 1 & balancedness_old == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_2 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_2 == 1 & balancedness_old == 1), robust

sum belongingness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_2 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_2 == 1 & balancedness_old == 1), robust

sum connectedness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Pro-Sociality

quietly reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_2 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_2 == 1 & balancedness_old == 1), robust

sum prosociality if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Check In And Chat
////////////////////

// Satisfaction With Life

quietly reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_3 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_3 == 1 & balancedness_old == 1), robust

sum satisfaction_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_3 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_3 == 1 & balancedness_old == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_3 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_3 == 1 & balancedness_old == 1), robust

sum belongingness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_3 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_3 == 1 & balancedness_old == 1), robust

sum connectedness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Pro-Sociality

quietly reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(services2_3 == 1 & balancedness_old == 1), robust
generate marker = 1 if(e(sample))

reg prosociality treatment_s i.age i.gender i.ethnicity i.religion i.condition i.isolating i.employment i.volunteered_before i.volunteered_elsewhere motivations_* services_* fidelity i.region i.date i.week_day newAdmissions cumAdmissions hospitalCases covidOccupiedMVBeds newCasesBySpecimenDate cumCasesBySpecimenDate newDeaths28DaysByDeathDate cumDeaths28DaysByDeathDate if(marker == 1 & services2_3 == 1 & balancedness_old == 1), robust

sum prosociality if(marker == 1)
tab treatment_s if(marker == 1)

drop marker


//////////////////////////////////
//////////////////////////////////
//////////////////////////////////
// C. Further Robustness Checks //
//////////////////////////////////
//////////////////////////////////
//////////////////////////////////

//////////////////////////////////////
// Table C1: Alternative Estimators //
//////////////////////////////////////

// Panel A: Ordered Logit Models
////////////////////////////////

quietly reg satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(balancedness == 1), robust
generate marker = 1 if(e(sample))

// Life Satisfaction

ologit satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust
ologit satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust or

// Sense of Purpose in Life

ologit worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust
ologit worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust or

// Panel B: Heteroskedastic Ordered Logit Models
////////////////////////////////////////////////

global x1 "i.age2 i.gender i.ethnicity2 i.religion i.condition i.isolating i.volunteered_before i.volunteered_elsewhere"
global x2 ""
global x3 ""
global x4 ""
global y1 ""
global y2 ""
global z ""

// Life Satisfaction

oglm satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust link(logit) hetero(treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z) force difficult
oglm satisfaction_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust link(logit) hetero(treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z) or force difficult

// Sense of Purpose in Life

oglm worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust link(logit) hetero(treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z) force difficult
oglm worthwhileness_life treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z postcode_admin_aggregated2_* if(marker == 1 & balancedness == 1), robust link(logit) hetero(treatment_a $x1 $x2 $x3 $x4 $y1 $y2 $z) or force difficult

drop marker


/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// E. Additional Analyses Using Extended Estimation Sample //
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
// Table E1: Heterogeneous Treatment Effects By Motivation //
/////////////////////////////////////////////////////////////

// Life Satisfaction

quietly reg satisfaction_life treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg satisfaction_life treatment_s##motivations2_* if(marker == 1 & balancedness == 1), robust
reg satisfaction_life treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(marker == 1 & balancedness == 1), robust

sum satisfaction_life  if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Sense of Purpose in Life

quietly reg worthwhileness_life treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg worthwhileness_life treatment_s##motivations2_* if(marker == 1 & balancedness == 1), robust
reg worthwhileness_life treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(marker == 1 & balancedness == 1), robust

sum worthwhileness_life if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Belongingness

quietly reg belongingness treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg belongingness treatment_s##motivations2_* if(marker == 1 & balancedness == 1), robust
reg belongingness treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(marker == 1 & balancedness == 1), robust

sum belongingness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

// Connectedness

quietly reg connectedness treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(balancedness == 1), robust
generate marker = 1 if(e(sample))

reg connectedness treatment_s##motivations2_* if(marker == 1 & balancedness == 1), robust
reg connectedness treatment_s##motivations2_* $x1 $x3 $x4 $y1 $y2 $z if(marker == 1 & balancedness == 1), robust

sum connectedness if(marker == 1)
tab treatment_s if(marker == 1)

drop marker

log close _all

